package com.bw.demoseckill.controller;


import com.bw.demoseckill.entity.TbGoods;
import com.bw.demoseckill.service.AdminService;
import com.bw.demoseckill.service.GoodsService;
import com.bw.demoseckill.utils.ResponseResult;
import com.sun.xml.internal.bind.v2.TODO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fxy
 * @since 2020-10-29
 */
@RestController
@RequestMapping("admin")
public class AdminController {

    @Autowired
    private AdminService adminService;

    @Autowired
    private GoodsService goodsService;

    /**
     * TODO 管理员登录
     * @return
     */
    @PostMapping(value = "/doLogin")
    public ResponseResult doLogin(@RequestParam("adminName") String adminName,
                                      @RequestParam("adminPwd") String adminPwd) {
        return adminService.doLogin(adminName,  adminPwd);
    }

    /**
     * TODO 管理员添加商品
     * @Author: 范欣宜
     * @Date: 2020/10/29 10:25
     * @param tbGoods:
     * @return: com.bw.demoseckill.utils.ResponseResult
     **/
    @PostMapping("/addGoods")
    public ResponseResult addGoods(@RequestBody TbGoods tbGoods){
        return goodsService.addGoods(tbGoods);
    }


}
